package com.exam.system.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * @Author LY
 * @create 2023/9/27 19:13
 * @Description 用户信息校验
 */
//@Service
@Slf4j
public class UserServiceImpl implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        log.info("当前登录用户：{}",username);
        // 匹配数据库
        UserDetails user = User.builder()
        .username("user")
        .password("{noop}123456")
        .roles("USER")
        .build();
        return user;
    }
}
